home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 128 28
/
q28.d81
/
t.name the song
< prev
next >
Wrap
Text File
|
2022-08-28
|
5KB
|
102 lines
N A M E T H E S O N G
Program and Text by Rick Kephart rmk@netaxs.com
FENDER'S PREMUMBLE: You may not be familiar with Rick Kephart because he
has only written for LOADSTAR 64 until now. I didn't even know he had a C-
128. But now that he's decided to tackle the 80-column 128 mode you're in
for a treat because, like Tina Turner, he nevah, evah does anything nice
and easy; he goes whole hog in everything he does. Where others may have
had 40 or 50 songs in a name-that-tune program, Rick has 128. In his
popular language quiz programs on LS 64 he'd include hundreds of foreign
words and their translations, then include a 60-block scholarly treatise on
the language. It's a style I like a lot and I think you will, too. Here's
Rick to tell you all about his first 128 program for LOADSTAR...
This is a song-guessing game.
For each song, you are given a clue at the bottom of the screen. The
clue may be a portion of lyrics, or an alternate title, or some facts about
the song, or some other means of identifying the melody.
You bet on how many notes you think it will take you to identify the
tune. The fewer the notes you think it will take, the bigger the bet. The
bet ranges from 1 point for the entire song, to 99 points for identifying
the song in one note.
Then you enter your guess in the guess box in the center of the screen.
The size of the box allows the exact length of the title of the song, to
the right edge of the box. This is a clear tipoff to the title; you can
only enter enough letters for the title and you must use all the spaces the
input routine will allow. For instance, for the WABASH CANNON BALL, you
can tell it's not WABASH CANNONBALL since there will be one space left
over.
If you can correctly identify the song, the number of points you bet is
added to your score. Otherwise, that number of points is deducted from
your score. You start out with 100 points to bet with. If your score
drops to nothing, then you lose. If your score reaches 500 or more, then
you win!
ADDING SONGS OF YOUR OWN
------------------------
There are 128 different songs in the program. You can easily add more
songs to the game! First, use RUN/STOP-RESTORE to exit to BASIC. Add your
new songs at the end of the program, but above line 20000. The last line
in the program must be RETURN.
The songs are simply normal PLAY strings in BASIC (see your System
Guide for details on how to write PLAY strings). They are stored in array
variables M$(). The next song to be added would be M$(129). The titles of
the songs are stored in the variables T$(1) to T$(128), so the next title
would be T$(129). The clues are stored in variables C$(). The default
tempo is TEMPO10. To play the tune at any other tempo, add a fourth
variable, T().
After adding your song, you must change the variable NS in the first
line. It is set at NS=128. Change this variable to the new number of
songs in the program, i.e. if you add one song, it will be NS=129. Add
another song, and you must change it to NS=130. This variable must contain
the exact number of songs in the program or the game will malfunction
eventually.
Then you can SAVE your new version of the game, with your tune(s)
added. With the disk in the drive you can simply enter GOTO 10000 to
scratch and save the new version.
The maximum number of songs there can be in this game is 255.
TECHNICAL NOTE
--------------
Line 10002
10002 RL=LEN(R$):IFRL=0THENFORRL=1TONS:R$=R$+CHR$(RL):NEXT:GOTO10002:ELSE:R
N=RND(0)*RL+1:R=ASC(MID$(R$,RN,1)):R$=LEFT$(R$,RN-1)+RIGHT$(R$,RL-
RN+1):RETURN
is what I believe to be the smallest, simplest, and fastest non-repeating
BASIC random selector possible. It will choose a random element from a
maximum of 255 choices, without repeating until all elements have been
chosen once; then it will restart selecting them in another random pattern.
GOSUB'd with variable NS containing the number of elements, it will return
a random value in variable R. It works by generating a string of bytes
[R$] from one to the maximum value. It then selects an individual
character from within that string, and then closes up the string and makes
it one character smaller. A similar system could easily be used in C-64
BASIC. It would be possible to slightly increase the speed by adding
another variable to store the full R$, and then restoring it to R$ when R$
is exhausted. But this would take an additional line and an additional
variable, and the pause for re-building R$ is imperceptible during the
game.
RK